﻿﻿
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>
        JS Console - Example
    </title>
    <link href="styles/js-console.css" rel="stylesheet" />
</head>

<body>
    <div id="js-console">
    </div>
    <script src="scripts/js-console.js">
    	
    </script>
    <script>
    		//Primitive types have a reference type wrapper
	var number = 5;
	var numberObj = new Number(5);

	jsConsole.writeLine("(number == numberObj) = " + (number == numberObj));
	jsConsole.writeLine("(number === numberObj) = " + (number === numberObj));
	jsConsole.writeLine("typeof number = " + typeof number);
	jsConsole.writeLine("typeof numberObj = " + typeof numberObj);
	jsConsole.writeLine("(typeof number === typeof numberObj) = " + (typeof number === typeof numberObj));

	//Primitive types are passed by value
	jsConsole.writeLine("-------------------");

	var fname = "Pesho";
	var lname = "Ivanov";
	var person = {
	    firstName: fname,
	    lastName: lname,
	    toString: function personToString() {
	        return this.firstName + " " + this.lastName
	    }
	};

	jsConsole.writeLine(person);
	jsConsole.writeLine("Changing the last name to Petrov");
	lname = "Petrov";
	jsConsole.writeLine(person) // still "Ivanov"
	
    </script>
</body>

</html>
